<template>
	<view>
		<view class="audition">
			<view class="audition_play_img" @click="play">
				<image :src="Audio.isPlay == audioIndex ? '../../static/icon/bf.png' : '../../static/icon/tz.png'"
					mode=""></image>
			</view>
			<view class="audition_right">
				<text>{{ timel.showTime1 }}</text>
				<view class="audition_play_progress">
					<slider @change="sliderChange" block-size="12" activeColor="#ff535b" :value="timel.duration" />
				</view>
				<text>{{ timel.showTime2 }}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'audition',
		data() {
			return {
				audioIndex: 3
			};
		},
		props: {
			Audio: {
				isPlay: 0 //0暂停，2播放
			},
			timel: {
				showTime1: '00:00',
				showTime2: '00:00',
				duration: 0
			}
		},
		// 用来接收父组件传给子组件的数据
		methods: {
			play() {
				this.$emit('auditionPlay', this.audioIndex);
			},
			sliderChange(e) {
				this.$emit('sliderChange', e);
			}
		}
	};
</script>

<style lang="scss" scoped>
	.audition {
		display: flex;
		justify-content: space-between;
		align-items: center;
		width: 676-20 * 2rpx;
		background: #ffffff;
		border-radius: 18rpx;
		padding: 30rpx 20rpx;

		.audition_play_img {
			width: 90rpx;
			height: 90rpx;

			image {
				width: 100%;
				height: 100%;
			}
		}

		.audition_play_progress {
			width: 400rpx;
		}

		.audition_right {
			display: flex;
			justify-content: space-between;
			align-items: center;

			text {
				font-size: 25rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #333333;
			}
		}
	}
</style>
